import java.util.*;

public  class jtest {
    public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            // 注意 hasNext 和 hasNextLine 的区别
            while (in.hasNextLine()) { // 注意 while 处理多个 case
                String string = in.nextLine();
                int len1 = string.length();
                StringBuilder stringBuilder = new StringBuilder();
                for(int i = 0; i < len1; i++){
                    Character j = string.charAt(i);
                    int len2 = stringBuilder.length();
                    if(stringBuilder.isEmpty() || stringBuilder.charAt(len2 - 1) != j){
                        stringBuilder.append(j);
                    }else{
                        stringBuilder.deleteCharAt(len2 - 1);
                    }
                }
                if(stringBuilder.length() == 0){
                    System.out.println(0);
                }else{
                    System.out.println(stringBuilder.toString());
                }
            }
    }
}

